import scala.collection.mutable
import scala.collection.mutable.ArrayBuffer
import scala.util.Random
import scala.math.BigInt._
import java.util.ArrayList

import breeze.linalg.SparseVector

/**
  * Created by liuwei on 2017/4/13.
  */
object Chapter1 {

  def main(args: Array[String]): Unit = {
    val a = 3
    val b = math.sqrt(a)
    println(b)
    val c = b * b
    println(c)
    println(3 - c)

    val d = "crazy" * 3
    println(d)

    val e = 10 max 2;
    println(e)

    val f = BigInt(2).pow(1024)
    println(f)

    val g = probablePrime(3, Random);

    val h = BigInt(Random.nextInt()).toString(36)
    println(h)

    val i = "affdllflfld"
    println(i(0))
    println(i.take(1))
    println(i.reverse(0))
    println(i.takeRight(1))
    println(i(i.length - 1))



    val analysisColumns = Seq("a","c")
    val titleNames = new ArrayList[String]()
    titleNames.add("a");
    titleNames.add("b");
    titleNames.add("c");
    titleNames.add("d");
    println()
    val array = ArrayBuffer[Int]()

    for(k <- 0 until titleNames.size){
      if(!analysisColumns.contains(titleNames.get(k))){
        array += k
      }
    }
println(array)


    analysisColumns.foreach(columnName=>{
      val columnIndex = titleNames.indexOf(columnName)
      println(columnIndex)
    })


    val v = SparseVector(1,3,5)
//    org.apache.spark.ml.linalg.SparseVector
//    val v = Vector(1,3,5)

    val ag:Double = 0

    println(ag == 0.0)

  }

}
